package com.tjnu.losca.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tjnu.losca.pojo.Employee;
import com.tjnu.losca.mapper.EmployeeMapper;
import com.tjnu.losca.service.IEmployeeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author losca
 * @since 2021-09-13
 */
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements IEmployeeService {

    @Override
    public IPage<Employee> getEmployee(Integer pageNum, int pageSize, String name) {
        QueryWrapper<Employee> wrapper = new QueryWrapper<>();
        if (StringUtils.isNotBlank(name)){
            wrapper.like("name", name);
        }
        return this.page(new Page<>(pageNum,pageSize),wrapper);
    }
}
